package com.wanjia.estate.constant;

import lombok.AllArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

@AllArgsConstructor
public enum FwxzType {

    FWXZ0("0","市场化商品房"),
    FWXZ1("1","动迁房"),
    FWXZ2("2","配套商品房"),
    FWXZ3("3","公共租赁住房"),
    FWXZ4("4","廉租住房"),
    FWXZ5("5","限价普通商品住房"),
    FWXZ6("6","经济适用住房"),
    FWXZ7("7","定销商品房"),
    FWXZ8("8","集资建房"),
    FWXZ9("9","福利房"),
    FWXZ99("99","其它");

    private final String code;
    private final String name;
    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static FwxzType get(String code) {
        return Stream.of(values())
                .filter(d -> Objects.equals(code, d.code))
                .findFirst()
                .orElse(null);
    }
}
